package drds.data_migrate.task_group.task.data_exchange.record;

import drds.common.Author;
import drds.data_migrate.Authors;
import drds.data_migrate.task_group.task.data_exchange.record.column.Column;

import java.util.ArrayList;
import java.util.List;

@Author(name = Authors.LI_YANG)
public class DefaultRecord implements Record
{

    private static final int RECORD_AVERGAE_COLUMN_NUMBER = 16;

    private List<Column> columnList;


    public DefaultRecord()
    {
        this.columnList = new ArrayList<Column>(RECORD_AVERGAE_COLUMN_NUMBER);
    }


    public void addColumn(Column column)
    {
        columnList.add(column);

    }

    public void setColumn(int index, final Column column)
    {
        if (index < 0)
        {
            /*throw DataExchangeException.asDataExchangeException(FrameworkErrorCode.ARGUMENT_ERROR,
                    "不能给index小于0的column设置值");*/
            throw new RuntimeException();
        }


        this.columnList.set(index, column);

    }

    public int getColumnListSize()
    {
        return this.columnList.size();
    }

    public Column getColumn(int index)
    {
        if (index < 0 || index >= columnList.size())
        {
            return null;
        }
        return columnList.get(index);
    }


}
